<template>
  <div class="top">
    <div class="left">
      <span class="lbtn" @click="goIndex">首页</span>
    </div>
    <div class="center">
      <div class="tit">智慧旅游可视化大数据平台</div>
    </div>
    <div class="right">
      <span>统计报告</span>
      <span>{{ date }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
/* 导入时间 */
import { getDate } from '../../directives/utils/date'
/* 存储时间*/
let date = ref<string>('')
/* 获取时间 */
const updateTime = () => {
  const { timeStr } = getDate()
  date.value = timeStr
}
/* 定时器执行获取实时时间 */
setInterval(() => updateTime(), 1000)
/* 前往首页 */
const goIndex = () => {
  location.href = 'home'
}
</script>

<style lang="scss" scoped>
.top {
  @include flexible(center);
  height: 50px;
  line-height: 50px;
  /* 左侧 */
  .left {
    flex: 1.5;
    height: 50px;
    background: url('../../images/dataScreen-header-left-bg.png') no-repeat;
    background-size: cover;
    .lbtn {
      float: right;
      display: block;
      width: 120px;
      height: 100%;
      color: #85e0e0;
      text-align: center;
      font-size: 18px;
      background: url('../../images/dataScreen-header-btn-bg-l.png') no-repeat;
      background-size: 100% 100%;
    }
  }
  /* 中间 */
  .center {
    flex: 2;
    height: 100%;
    line-height: 50px;
    background: url('../../images/dataScreen-header-center-bg.png') no-repeat;
    background-size: 100% 100%;
    .tit {
      width: 100%;
      font-size: 25px;
      text-align: center;
      color: #85e0e0;
    }
  }
  /* 右侧 */
  .right {
    @include flexible(center);
    justify-content: space-between;
    flex: 1.5;
    height: 100%;
    background: url('../../images/dataScreen-header-right-bg.png') no-repeat;
    background-size: 100% 100%;
    span:nth-child(1) {
      display: block;
      width: 120px;
      height: 100%;
      text-align: center;
      color: #85e0e0;
      font-size: 18px;
      background: url('../../images/dataScreen-header-btn-bg-r.png') no-repeat;
      background-size: 100% 100%;
    }
    span:nth-child(2) {
      margin-right: 20px;
      display: block;
      height: 100%;
      text-align: center;
      font-size: 18px;
      color: #85e0e0;
    }
  }
}
</style>
